using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Data/State/Player/PlayerGameOver", fileName = "PlayerGameOver")]
public class PlayerState_GameOver : PlayerState
{
    //
    public override void Enter()
    {
        base.Enter();
        // 打开死亡界面
        UIManager.Instance.OpenPanel(UIConst.PANEL_GAMEOVER);
        // 关闭玩家检测
        playerBox2D.enabled = false;
        // 速度设置为零
        playerControl.SetVelocity(Vector2.zero);
    }
    
    //
    public override void Exit()
    {
        base.Exit();
        // 复活状态设置为false
        playerStatusInformation.IsRevive = false;
    }
    
    //
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        // 如果玩家选择复活，则回到重生点
        if(playerStatusInformation.IsRevive)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Spawn)]);
    }
    
    //
    public override void PhysicalUpdate()
    {
        base.PhysicalUpdate();
    }
}
